/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package exiftool;
import javax.swing.event.*;
import javax.swing.*;
/**
 * Selection listener for Table1 events.
 *
 * @author chris
 */
public class table1SelectionListener implements ListSelectionListener {
        public void valueChanged(ListSelectionEvent e) {
            ListSelectionModel lsm = (ListSelectionModel)e.getSource();

            int firstIndex = e.getFirstIndex();
            int lastIndex = e.getLastIndex();
            boolean isAdjusting = e.getValueIsAdjusting();
            System.out.print("Event for indexes "
                          + firstIndex + " - " + lastIndex
                          + "; isAdjusting is " + isAdjusting
                          + "; selected indexes:");

            if (lsm.isSelectionEmpty()) {
                System.out.println(" <none>");
            } else {
                // Find out which indexes are selected.
                int minIndex = lsm.getMinSelectionIndex();
                int maxIndex = lsm.getMaxSelectionIndex();
                for (int i = minIndex; i <= maxIndex; i++) {
                    if (lsm.isSelectedIndex(i)) {
                        System.out.println(" " + i);
                    }
                }
            }
            //output.append(newline);
            //output.setCaretPosition(output.getDocument().getLength());
        }
}
